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 »

Yeah, I still don't like the notation but I've got used to reading and writing it now. A good code editor is essential - at the very least you'll want indentation and bracket matching. Otherwise it does suck, certainly.
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Post by adam »

GoatFoam wrote: I don't dispute the power of the language - that is obvious. I just don't get on with the notation. (f x) just seems less natural than f(x).

That is just me being old and inflexible though, so I think I will pick scheme up and have another go after my next project.
from my understanding, if you don't like the syntax, you can change it, in this case i think it'd be a macro to jiggle the brackets or list comprehension round a bit.

i put a link in this thread about code walking which might shed more light on that sort of thing.

another post i read, which i may have put on here talked about some lispers breaking up their code with line breaks to make it more readable

f [x y
[x y z]]
User avatar
failrate
Baaaaaa!
Baaaaaa!
Posts: 2354
Joined: Sun May 23, 2004 6:54 am 0
Location: Sandy Eggo
Contact:

Post by failrate »

Yeah, I was actually thinking about how to write an interpreter to do just that, but I came to two revelations:
By the time you're good enough to write that interpreter, you're just used to the Lisp syntax.
If you really want Lisp-like functionality with C-ish syntax, then you can use JavaScript.
User avatar
lis0r
Baaaa!
Baaaa!
Posts: 894
Joined: Tue Jan 10, 2006 9:26 am 0
Location: The Frozen Wastelands Of The North

Post by lis0r »

adam wrote:from my understanding, if you don't like the syntax, you can change it, in this case i think it'd be a macro to jiggle the brackets or list comprehension round a bit.
The problem with approaches like these are that they provide an artificial distinction between code and data.

The syntax is difficult for people used to more popular languages, but it helps put one in the right headspace.
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Post by adam »

thanks lisor, another bit for the mental processing (mine that is)
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Post by adam »

adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Post by adam »

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 »

Does anyone know how I can get access to the Scheme REPL while a program is running? I'm using PLT-Scheme via DrScheme but the interactions window freezes while a program is running.

I'm thinking of a more restrictive version of the live coding thing that nebogeo did - I want the program to run, but I want to be able to rewrite code as it's going (which is one of the main advantages of a LISP I think).

I'm sure this is no minor undertaking but I've absolutely no idea where to start. :)
User avatar
nebogeo
Baa!
Baa!
Posts: 75
Joined: Wed Mar 31, 2004 10:11 pm 0
Contact:

Post by nebogeo »

teamonkey wrote:Does anyone know how I can get access to the Scheme REPL while a program is running?
I'm not sure if this is possible in DrScheme or not, but I did this by embedding mzscheme in my own app, then you can get a hook into the interpreter and run bits of scheme whenever you want.

Thinking about it more, you might be able to do things like this with a PLT thread - if you launch one which loops, the repl gets control back, but the thread is left running. You might be able to alter it from the repl - this won't work from the main editor though, as the threads are killed when you press F5.
User avatar
failrate
Baaaaaa!
Baaaaaa!
Posts: 2354
Joined: Sun May 23, 2004 6:54 am 0
Location: Sandy Eggo
Contact:

Post by failrate »

You make sure that you are yielding in the main loop timer:

Code: Select all

;; Start the main loop's timer
(define main-loop-timer
  (instantiate timer% ((lambda () (begin (update active-sprites) yield)) timer-interval #f)))
This example was taken from my shmup game, but I cribbed it from the MzScheme doccos. Assuming you've started your application from DrScheme, and you are yielding once per frame, you should be able to use your original DrScheme window to interact with the live application.
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 »

That's it! Thanks very much.
User avatar
pasquinelli
Baaaa!
Baaaa!
Posts: 812
Joined: Wed Nov 12, 2003 10:45 pm 0
Location: chicago, il, usa

Post by pasquinelli »

found this:

http://www.haskell.org/visualhaskell/

turns visual studio 2003 or 2005 into a haskell ide.

haven't tried it yet, but it looks interesting.
[*]]
[*]]^|
User avatar
nebogeo
Baa!
Baa!
Posts: 75
Joined: Wed Mar 31, 2004 10:11 pm 0
Contact:

Post by nebogeo »

Has anyone played with functional reactive programming/animation?

http://www.haskell.org/frp/

The main hook (I think) is that functions which reference a variable internally get called automatically when it changes, which removes the need for callbacks or complicated state flow - it should scale really well (much better than state machines I think).

The challenge:
http://prog21.dadgum.com/4.html
http://ezrakilty.net/research/2007/01/f ... ssing.html

PLT scheme has the FrTime language (Father Time) for this:
http://pre.plt-scheme.org/plt/collects/frtime/doc.txt
The `frtime' collection contains the implementation of FrTime, a
language that supports declarative construction of reactive systems
through signals, or time-varying values. Signals are classified as
either behaviors, which have a value at any point in (conceptually
continuous) time, or events, which are streams of discrete
occurrences. Unlike (for example) boxes, the time-varying nature of
signals propagates automatically to expressions in which they are
used.
Which I got cooperating with fluxus last night - so I'm going to have a play... Just wondered if any of you lot had gone down this path already.
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 »

I've just been reading this pdf paper on FRP and it sounds quite interesting. I'm really interested in seeing what you find.
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Post by adam »

Post Reply