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 Lisp for ANN programming
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
 
Daniel Rupis  
View profile  
 More options Nov 15 2012, 5:25 am
Newsgroups: comp.lang.lisp
From: Daniel Rupis <danielrupistraliza...@yahoo.es>
Date: Thu, 15 Nov 2012 02:25:33 -0800 (PST)
Local: Thurs, Nov 15 2012 5:25 am
Subject: Re: Lisp for ANN programming
 WJ  said

> (def zeros (take 10 (repeat 0)))

> (map-indexed #(if (zero? (mod (inc %1) 3)) (inc %2) %2) zeros)

> --> (0 0 1 0 0 1 0 0 1 0)

A trivial translation follows. Since it seems that you have plenty of time available for playing with clojure and common-lisp, what about developing a library that implements clojure in common lisp?

(map-indexed ($(i x) (if (zerop (mod (1+ i) 3)) (1+  x) x)) zeros)

given the following definitions:

(defun map-indexed (fun list)
 (let ((i 0))
   (mapcar (lambda(x) (prog1 (funcall fun i x) (incf i))) list)))

(defun repeat (times val)
  (loop repeat times collect val))

(defparameter zeros (repeat 10 0))

(defmacro $ (vars &rest body)
  `(lambda ,vars ,@body))


 
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.