Search found 45 matches

by saulgoode
Fri May 09, 2014 10:08 am
Forum: Homework
Topic: from '((a b c d e)((f g h)(i j k))(l m n o))) to '((a b c d
Replies: 1
Views: 4642

Re: from '((a b c d e)((f g h)(i j k))(l m n o))) to '((a b

I'm not aware of any library function that performs that directly, but it can be accomplished fairly easily if you break it down into manageable steps. It appears that your input is a list in the form: (item1 item2 item3) and each of the items will be either a list of atoms: (atom1 atom2 atom3) or a...
by saulgoode
Fri Apr 25, 2014 1:25 pm
Forum: Scheme
Topic: Little help about define procedure
Replies: 3
Views: 8769

Re: Little help about define procedure

It is recommended practice in Scheme to never really DEFINE a variable that has already been DEFINEd. For interactive operations, it is permitted but it can be a source of problems/confusion. The example given isn't, IMO, especially well designed in that the 'sqrt' procedure that you define should b...
by saulgoode
Sun Feb 16, 2014 6:33 am
Forum: The Lounge
Topic: Original Lisp Eliza added to Eliza Gen collection
Replies: 3
Views: 7595

Re: Original Lisp Eliza added to Eliza Gen collection

The transcription is apparently complete and the text files made available on Github.

A clisp version by Peter De Wachter, Matt Niemeir, and Jeff Shrager is also available for download.
by saulgoode
Fri Nov 01, 2013 10:22 am
Forum: Homework
Topic: Cannibals and missionaries help!!!
Replies: 1
Views: 5825

Re: Cannibals and missionaries help!!!

In your 'safe' procedure, you have 'nil' as part of the first predicate of the 'cond' (and serves no purpose in this position). It should be the evaluated consequent.

In other words, one of the closing parentheses is in the wrong place.
by saulgoode
Thu Oct 24, 2013 5:58 pm
Forum: Common Lisp
Topic: Quicksort?
Replies: 2
Views: 3236

Re: Quicksort?

The bindings in a let block are not guaranteed to be handled in sequence. They might be evaluated in a different order than specified, or evaluated in parallel on a multi-threaded implementation. If you wish to have the bindings evaluated in a specific order (so later bindings can reference earlier ...
by saulgoode
Sun Oct 13, 2013 9:40 am
Forum: Homework
Topic: Knight Project
Replies: 6
Views: 9783

Re: Knight Project

The problem you've stated does not actually require that you create a chessboard. When your program attempts to move a piece, it cares whether 1) you have exceeded the 'upper limit' for number of moves allowed, 2) the move is valid for a knight, 3) the destination square lands on the chessboard, and...
by saulgoode
Thu Oct 10, 2013 4:22 am
Forum: Homework
Topic: Knight Project
Replies: 6
Views: 9783

Re: Knight Project

The stated problem can be simplified to the task of finding the shortest path from the white knight's starting square to the black knight's starting square. The actual place where the knights meet each other would lie midway along this path. Unlike the Knight's Tour problem, there are an infinite nu...
by saulgoode
Mon Apr 29, 2013 7:14 pm
Forum: The Lounge
Topic: Hello, am I even in the right place?
Replies: 9
Views: 19334

Re: Hello, am I even in the right place?

If you tire of reading, there are some great video lectures by Hal Abelson and Gerald Sussman available from MIT (link below). The videos are from the 1980s -- so no laptops hooked up to video projectors showing powerpoint slides -- but the material is still relevant, and pretty easy to follow (thou...
by saulgoode
Wed Apr 24, 2013 4:09 pm
Forum: Scheme
Topic: Simply Scheme Exercises. Chapter 06 True and False.
Replies: 3
Views: 9279

Re: Simply Scheme Exercises. Chapter 06 True and False.

korekaradesu wrote:But in the interpreter, it returns the value of (empty? 3).
Your interpreter should return the value 3 for the cond expression.
by saulgoode
Sat Apr 20, 2013 4:30 am
Forum: Scheme
Topic: A pair of lists
Replies: 0
Views: 4799

A pair of lists

I am writing a tutorial on developing a Scheme compiler and one of the data structures I am using is a pair of lists, where the car of the pair is a list of the symbols and the cdr of the pair is a list of their values. For example, an a-list of the data might be ' ((a . 10) (b . 20) (c . 30)) And t...