Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion toy list processing problem: collect similar terms
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark Tarver  
View profile  
 More options Feb 14 2011, 8:32 am
Newsgroups: comp.lang.lisp, comp.lang.functional
From: Mark Tarver <dr.mtar...@ukonline.co.uk>
Date: Mon, 14 Feb 2011 05:32:36 -0800 (PST)
Local: Mon, Feb 14 2011 8:32 am
Subject: Re: toy list processing problem: collect similar terms
In Qi

(35-) (group [[0 a b] [1 c d] [2 e f] [3 g h] [1 i j]
              [2 k l] [4 m n] [2 o p] [4 q r] [5 s t]])
[[a b] [g h] [c d i j] [e f k l o p] [m n q r] [s t]]

Program is:

(define group
  L -> (map (grouph L) (rd (map head L))))

(define grouph
  [] _ -> []
  [[X | Y] | Z] X -> (append Y (grouph Z X))
  [_ | Y] X -> (grouph Y X))

(define rd
  [] -> []
  [X | Y] -> (if (element? X Y) (rd Y) [X | (rd Y)]))

Couldn't post this under OP because this option was not given under
Google news.

Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.