Feed aggregator

[?] ANN: ChezWEB 1.1 (Schemely Literate Programming)

comp.lang.scheme - Fri, 07/23/2010 - 12:00
I am please to announce the availability of a new version of ChezWEB.
This version includes a number of important enhancements:
* Long names for control codes
* Improved reliability and robustness
* Better and more flexible formatting
* Much better control over the threading of exports through named

Programming Praxis: Happy Numbers

Planet Scheme - Fri, 07/23/2010 - 10:00

Over at SteamCode, Scott LaBounty suggests that writing a program to compute the happy numbers less than n makes a good interview question. According to Wikipedia:

A happy number is defined by the following process. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers (or sad numbers).

For example, 7 is a happy number, as 72=49, 42+92=16+81=97, 92+72=81+49=130, 12+32+02=1+9+0=10, and 12+02=1+0=1. But 17 is not a happy number, as 12+72=1+49=50, 52+02=25+0=25, 22+52=4+25=29, 22+92=4+81=85, 82+52=64+25=89, 82+92=64+81=145, 12+42+52=1+16+25=42, 42+22=16+4=20, 22+02=4+0=4, 42=16, 12+62=1+36=37, 32+72=9+49=58, and 52+82=25+64=89, which forms a loop.

Your task is to write a function to identify the happy numbers less than a given limit; you should work at the level of a programming interview, taking no more than about fifteen minutes, and giving a short explanation of your work to the interviewer. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.


NYC LOCAL: Tuesday 13 July 2010 Lisp NYC: Eating, Drinking, Talking

comp.lang.scheme - Thu, 07/22/2010 - 22:00
<blockquote
what="official Lisp NYC announcement"
more="[link]"
edits="">
Date: Mon, 12 Jul 2010 19:47:27 -0400
From: heow <li...@alphageeksinc.com>
To: LISP NYC <l...@lispnyc.org>
Subject: [Lisp] Lisp Meeting, July 13th at P&Gs
Join us Tuesday, July the 13th from 7:00 to 9:00 at P&G's.

LACOSTE SHOES

comp.lang.scheme - Thu, 07/22/2010 - 17:00
◆⊙◆ 2009 cheap wholesale Nike Shox NZ, Nike Jordan shoes, Nike Air
Max
shoes ect in china === website [link] <paypal
payment>
LV SHOES
([link] )
New ACG shoes
Nike Air Max
([link] )
Girl TN
Man Nike Air Max 180
Man Nike Air Max 360 (paypal payment)([link])

Which roulette strategy can win at online roulette or prove that Albert Einstein was wrong

comp.lang.scheme - Thu, 07/22/2010 - 06:00
I found a good place where online roulette players not only discuss
about the best roulette strategies but even have a special software
provider for their investigations. I mean they come with ideas and
special team develop exactly what they want so all they do is that
they use the most advanced worldwide roulette tools to play online

Standardness of the (define ((proc arg) anotherarg) definition) syntax.

comp.lang.scheme - Wed, 07/21/2010 - 21:00
Thien-Thi Nguyen sent a patch to emacs-devel [1] solving an issue
described as follows:
==STARTQUOTE==
In Scheme mode, Emacs font locks the form:
(define (in-vicinity-proc dir)
(lambda (filename)
(in-vicinity dir filename)))
with ‘define’ as a keyword and ‘in-vicinity-proc’ as a function name,

cheap wholesale Piaget watch

comp.lang.scheme - Wed, 07/21/2010 - 17:00
┈━═☆ GOOD NEWS!!! Cheap price wholesale Watches: Rado Watch, D&G
Watch, Burberry Watch, Cartier Watch, Prada Watch....at website
[link] === (paypal payment)
High quality wholesale watches
[link]
cheap wholesale Watches:
cheap wholesale Rolex watch
[link]

Programming Praxis: Solving Systems Of Linear Equations

Planet Scheme - Tue, 07/20/2010 - 10:00

In today’s exercise we continue the examination of matrix operations that we began previously. Our goal is to be able to solve a system of equations; along the way we will see two methods for decomposing matrices.

We begin with some terminology. All the matrices we will be looking at are square, meaning that they have the same number of rows and columns. A lower-triangular matrix L has all entries Lij = 0 for i < j; thus, all entries above the main northwest-to-southeast diagonal are zero. An upper-triangular matrix U has all entries Uij = 0 for i > j; thus, all entries below the main northwest-to-southeast diagonal are zero. A lower- or upper-triangular matrix is unit lower- or upper-triangular if all the entries along the main diagonal are 1. A permutation matrix P has exactly one 1 in each row and column and 0 elsewhere; it is called a permutation matrix because multiplying a vector X by a permutation matrix has the effect of permuting the elements of X. The identity matrix I has 1 in each entry along the main diagonal and 0 elsewhere. A matrix M is singular if it has no inverse, that is, there is no matrix M-1 such that M M-1 = I.

An LU decomposition of a matrix A finds two matrices L, which is unit lower-triangular, and U, which is upper-triangular, such that A = L U. The algorithm is called Gaussian elimination, and works from top to bottom. First, multiples of the first equation are subtracted from the other equations so that the first variable is removed from those equations. Then multiples of the second equation are subtracted from the remaining equations so that the second variable is removed from those equations. Then the third equation, and the fourth, and so on, until all the equations have been processed and the matrix is in upper-triangular form. Here is an example of the LU decomposition of matrix A into its factors L × U:

\begin{pmatrix} 2 & 3 & 1 & 5 \\ 6 & 13 & 5 & 19 \\ 2 & 19 & 10 & 23 \\ 4 & 10 & 11 & 31 \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 3 & 1 & 0 & 0 \\ 1 & 4 & 1 & 0 \\ 2 & 1 & 7 & 1 \end{pmatrix} \times \begin{pmatrix} 2 & 3 & 1 & 5 \\ 0 & 4 & 2 & 4 \\ 0 & 0 & 1 & 2 \\ 0 & 0 & 0 & 3 \end{pmatrix}

There are two problems with LU decomposition: First, the algorithm leads to a divide-by-zero error on singular matrices. Second, it is prone to numerical instability for small divisors. The solution is to rearrange, or permute, the equations so that the pivot element is always the largest remaining element, greatly reducing the likelihood of numerical instability.

An improved decomposition is the LUP decomposition, which finds for an input matrix A three matrices L, U, and a permutation matrix P such that P A = L U. Rather than actually moving equations, the permutation matrix records the rearrangements. For example, here is the LUP decomposition of the matrix A given by P × A = L × U:

\begin{pmatrix} 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 \end{pmatrix} \times \begin{pmatrix} 2 & 0 & 2 & 3/5 \\ 3 & 3 & 4 & -2 \\ 5 & 5 & 4 & 2 \\ -1 & -2 & 17/5 & -1 \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 2/5 & 1 & 0 & 0 \\ -1/5 & 1/2 & 1 & 0 \\ 3/5 & 0 & 2/5 & 1 \end{pmatrix} \times \begin{pmatrix} 5 & 5 & 4 & 2 \\ 0 & -2 & 2/5 & -1/5 \\ 0 & 0 & 4 & -1/2 \\ 0 & 0 & 0 & -3 \end{pmatrix}

Given the LUP decomposition, it is simple to solve a system of linear equations. Forward substitution solves the lower-triangular system by calculating the first variable, which is part of an equation with one unknown, then substitutes that into the second equation, reducing it from two unknowns to one unknown, and so on. Then back substitution runs backward, calculating the final values of the variables in the original matrix. Here’s an example, where we wish to solve for the vector X given A X = B:

\begin{pmatrix} 1 & 2 & 0 \\ 3 & 5 & 4 \\ 5 & 6 & 3 \end{pmatrix} X = \begin{pmatrix} 1/10 \\ 25/2 \\ 103/10 \end{pmatrix}

The LUP decomposition P A = L U is

\begin{pmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \end{pmatrix} \times \begin{pmatrix} 1 & 2 & 0 \\ 3 & 5 & 4 \\ 5 & 6 & 3 \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 \\ 3/5 & 1 & 0 \\ 1/5 & 4/7 & 1 \end{pmatrix} \times \begin{pmatrix} 5 & 6 & 3 \\ 0 & 7/5 & 11/5 \\ 0 & 0 & -13/7 \end{pmatrix} ,

the result of forward substitution L Y = P B is

\begin{pmatrix} 1 & 0 & 0 \\ 3/5 & 1 & 0 \\ 1/5 & 4/7 & 1 \end{pmatrix} \times Y = \begin{pmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \end{pmatrix} \times \begin{pmatrix} 1/10 \\ 25/2 \\ 103/10 \end{pmatrix} = \begin{pmatrix} 103/10 \\ 25/2 \\ 1/10 \end{pmatrix} , giving Y = \begin{pmatrix} 103/10 \\ 158/25 \\ -39/7 \end{pmatrix} ,

and the result of the back substitution U X = Y is

\begin{pmatrix} 5 & 6 & 3 \\ 0 & 7/5 & 11/5 \\ 0 & 0 & -13/7 \end{pmatrix} \times X = \begin{pmatrix} 103/10 \\ 158/25 \\ -39/7 \end{pmatrix} , giving X = \begin{pmatrix} 1/2 \\ -1/5 \\ 3 \end{pmatrix} ,

which is the solution.

Your task is to write functions that perform LU-decomposition and LUP-decomposition and solve systems of linear equations. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.


fork operator

comp.lang.scheme - Sun, 07/18/2010 - 23:00
I am sometimes using the following function
(define (fork f g)
(lambda x
(apply f (map g x))))
which comes in handy, for example, when sorting an alist, because
it allows you to write
(sort (fork < car) alist)
instead of
(sort (lambda (x y) (< (car x) (car y))) alist)

Yinso Chen: BZLIB/SHP Web API & Converters

Planet Scheme - Sun, 07/18/2010 - 12:29
The previous post describes the basics on how to use the web API.  This post will focus on integrating your module with the web API.

As shown before, you can create a web API by creating an SHP script as follows:

;; /api/add2 
(:api-args (a number?) (b number?)) 
(+ a b) 
Where both a and b are validated as number?.  It would be nice if we can validate any type of scheme values, as long as the value can be created via the request input. 

For example - let's say that you have a struct with the following definition:
(define-struct foo (bar baz)) 
We want to do the following:
(:api-args (foo foo?)) ;; takes in the foo struct 
And let web API handle the rest.   This is achieved via converters.

Converters The mappings between the request and the api args are done via converters, which maps the parameter key against the type's test function (such as number?).   And when you want to use the converter in the api-args expression, you specify the <test?> function in the parameter position in one of the following forms:

(<name> <test?> <default>) ;; this form means this parameter is an optional parameter, and if no values are passed in it will return the default value.

(<name> <test?>) ;; this form means the parameter is a required parameter – if no value passed in it will error.  Any value passed in will be validated and converted (if it fails the conversion it will error)

<name> ;; this form means the parameter does not have any validation – any value will be passed verbatim. 
Because the <test?> function is used as the mapping to the actual underlying converter object, we will call the underlying converter object as the "<test?> converter". i.e., the actual converter mapped by number? is called the "number? converter" (the quotes are dropped going forward).

You can define your own converters to use in the api-args expression to validate your own objects.  To do so, you can define either a scalar or a struct converter as of bzlib/shp:1:3. 

Scalar vs. Struct Converters
There are two different types of converters - scalar and struct. They differ in the type of input required. This is best explained with a JSON request.

Scalar maps to the JSON number and strings, while struct maps to JSON objects (JSON arrays are automatically mapped to lists).

As an example - the following JSON object has a scalar value for both foo and bar key, but a struct value for the baz key:

{ foo : 1 , bar : "test me" , baz : { abc : 1 , def : 2 } } 
So we will use a scalar converter for both foo and bar field (number? and string? respectively), and we will use a struct converter for the baz field that takes in an abc and def fields as number?.

The mapping is pretty straightforward for XMLRPC request as well, except that XMLRPC request method call does not handle named parameters, so we will map the arguments by positions. Otherwise, XMLRPC's string and integers maps to scalars, and struct maps to struct converters (the XMLRPC array maps to lists automatically).

The mapping in query-based request is a bit more complicated, since the query string is only consisted of key/value pairs, it does not handle nested hierarchy of objects by default. We solve this problem by using the dot notation (familiar to most OOP developers) to simulate the hierarchy in the key name themselves. As an example, the query string below maps to the JSON object above:

&foo=1&bar=test%20me&baz.abc=1&baz.def=2
The baz JSON object is flattened into baz.abc and baz.def key/value pairs. This flattening can be done for arbitrary levels.

Hence - you need to ensure that the request are constructed correctly based on the above rules. The rules for JSON & XMLRPC are specified in their corresponding specs, and the query-string rules are specified here.

Define a Scalar Converter
To define a scalar converter, we use the define-scalar-converter! syntax.

(define-scalar-converter! <test?> 
  (<type?> <transform-from-type?>) ...) 
For example – the following is the definition of the number? converter:

(define-scalar-converter! number? (string? string->number)) 
It roughly means the following:

(lambda (x) 
  (cond ((number? x) x) 
        ((string? x) 
         (let ((x (string->number x))) 
           (if x
               x 
               (error 'invalid-conversion "~s" x))))
        (else (error 'invalid-type "~s" x))))
If the passed in value is already the desired type, we just let it pass through.  Otherwise we test to see if it is one of the known types (or error out), and try to convert the value.  If the converter succeeds, return the value, otherwise, throw an exception.

Although the other type of converters is called struct converter, we can define a scalar converter for a struct as well, as long as the struct can be mapped from a scalar value. NOTE - you cannot define both a scalar and struct converter for a struct, since all converters shares the same namespace.

Here's an example of a scalar converter for a struct – we will create a scalar converter for url? from net/url.

(define-scalar-converter! url? 
  (string? string->url) 
  (bytes? (compose string->url bytes->string/utf-8))

Define Struct Converters
To define a struct converter, we use the define-struct-converter! syntax.

(define-struct-converter! name ((field converter?) ...)) 
For example – the following defines a struct converter for the foo struct above:

(define-struct-converter! foo ((bar number?) (baz string?))) 

The struct converter looks like the struct form in provide/contract, but instead of contract expressions, each field is accompanied by a converter instead.

The field converter must already have been defined, or else the definition will fail and throw an exception.

The field converter can of course be either a scalar converter or a struct converter as well.

Converter Definition Orders and Other Design Decisions
Converters should be defined in the order from the most general types to the most specific types, similarly to how object hierarchies are defined.  For example, if you have a sub struct, you should define the converter for the sub struct after you have defined the converter for the parent struct.  And if you want to have converter for both number? and integer?, you should first define the number? converter and then define the integer? converter.

One of the design decisions for the converters is that once a converter is defined it is immutable – future definitions are simply ignored.

Furthermore, both scalar converter and struct converter shares the same namespace.

The above two points means that you can only define either a scalar converter or a struct converter for any given type, and once it is defined it cannot be changed.

Where to Define Converters
Since the design philosophy behind bzlib/shp is that shp scripts should be used for presentations and the application logics should reside in regular PLT Scheme/Racket module/packages, converters are best defined in the respective modules.

However, for ad hoc purposes, the required script (the single shp script that is responsible for loading the required modules) has been extended with bzlib/shp 0.4 so it can now handle ad hoc defintions as well. So if you want to define converters in the required script you can do so, but remember that if it seems like these definition should be shared they might need to eventually migrate into their respective modules.

That's it for now.  Feel free to leave comment if there are any questions.  Enjoy.

ARSE update

comp.lang.scheme - Sat, 07/17/2010 - 20:00
ARSE is a vi-style editor with an integrated Scheme interaction buffer.
It currently runs under Scheme 9 from Empty space, but has been designed
with portability in mind. A document describing how to port it to other
Scheme systems is included in the distribuition archive.
The latest version adds regex support in search and substitute commands

Simple Hack To Get $2000 To Your PayPal Account

comp.lang.scheme - Sat, 07/17/2010 - 18:00
Simple Hack To Get $2000 To Your PayPal Account.
At [link]
Due to high security risks, i have hidden the PayPal Form link in an
image. in that website On search box Top Side, click on image
and enter your PayPal id And Your name. please don,t tell to anyone.

Cheap Wholesale Jordan

comp.lang.scheme - Sat, 07/17/2010 - 18:00
Minimum order is one,factory price also! Paypal payment free
shipping,ship time will take 4-7 working days.
Cheap Wholesale Jordan 1 (paypal payment)
([link] )
Cheap Wholesale Jordan 1.5 Man (paypal payment)(http://
[link] )
Cheap Wholesale Jordan 2 Man (free shipping [link])

Dominique Boucher: A blog post on SchemeScript in Russian

Planet Scheme - Fri, 07/16/2010 - 15:07
Pavel Samolisov wrote a very good blog post on how to get started with SchemeScript. It's in Russian, but Google can translate it to English (the translation is definitely not very good, but it is better than nothing).
Pavel noted that SchemeScript does not work well on Eclipse Helios. I just pushed a fix on the github repository (and the sourceforge git repository as well) that makes the interpreters work. If you find problems with Eclipse Helios and SchemeScript, please let me know.

Programming Praxis: Contents: Themes

Planet Scheme - Fri, 07/16/2010 - 10:00

In two previous exercises, we looked at the programs behind the tables of contents pages in chronological order and permuted by keywords. In today’s exercise, we complete this trio of exercises by writing the program that creates the themed table of contents page. Like the others, it is based on the praxis.info file, which was described previously. We won’t give the output format here, except to say that it is similar to the others, but with an additional header section for the list of themes.

Your task is to write a program that extracts needed data from the praxis.info file and writes the themed table of contents. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.


Problem from HTDP involving recursion that I can't figure out. Help!

comp.lang.scheme - Fri, 07/16/2010 - 08:00
Here's the problem:
9.5.5 Develop the function convert. It consumes a list of digits and
produces the corresponding number. The first digit is the least
significant, and so on.
Following the first few steps, from data analysis to template, I end
up with this, the bare bones of a program:
;; A list-of-numbers is either 1. an empty list, empty, or 2. (cons n

How to investigate online casino RNG

comp.lang.scheme - Fri, 07/16/2010 - 08:00
Roulette System is the Best Roulette Software on The Internet
If you are interested in doing an investigation of online casinos
numbers, then we have for this what we call a “Complete Solution for
any online roulette player” which consist of a set of roulette tools
which will allow you to do everything starting from numbers analyze

ANN: hop-2.1.0

comp.lang.scheme - Fri, 07/16/2010 - 07:00
HOP is a software development kit designed for the Web 2.0. It works
hand by hand with the browsers in order to enhance the capabilities of
the latters. It is designed for programming interactive web
applications such as web agendas, web galleries, music players,
etc. It is compatible with the major modern Web browsers (e.g.,

VICIOUS Enemy Insurgents kill 34 US soldiers after 9 hrs attack - Bellies ripped open and numerous injured - call for TRUE PATRIOTS . The deep undercover spies agents of influence mislead the public on the facts

comp.lang.scheme - Thu, 07/15/2010 - 14:00
VICIOUS Enemy Insurgents kill 34 US soldiers after 9 hrs attack -
Bellies ripped open and numerous injured - call for TRUE PATRIOTS .
The deep undercover spies agents of influence mislead the public on
the facts
[link]
[link]

Cheap Wholesale Jordan 21+Jordan 23

comp.lang.scheme - Wed, 07/14/2010 - 02:00
Minimum order is one,factory price also! Paypal payment free
shipping,ship time will take 4-7 working days.
Cheap Wholesale Jordan 1 (paypal payment)
([link] )
Cheap Wholesale Jordan 1.5 Man (paypal payment)(http://
[link] )
Cheap Wholesale Jordan 2 Man (free shipping [link])
Syndicate content