1
2
3
4
;;; LIS is a list of (possibly repeated) elements
;;; COMPARE is a boolean function of two elements, such as > (which is the default)
;;; This returns the next lexicographically larger (via COMPARE) list of those same elements
...

Lisp On Lexicographically next perm...

by M Tyson, June 29, 2008 09:49

The initial example code ha...

Avatar Talk
1
2
3
(define (group-by x n)
  (unfold
...

Lisp On Group-by

by Chris Jester-Young, June 29, 2008 09:33

The function can be made ev...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
(define (split-at-or-earlier! x i)
  (let 
...

Lisp On Group-by

by Chris Jester-Young, June 25, 2008 17:36

Here is a demonstration of ...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
;; To activate SRFI 1:
;; MzScheme 372: (require (lib "1.ss" "srfi"))
...

Lisp On Group-by

by Chris Jester-Young, June 23, 2008 10:59

Here's a very cheap answer ...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
(define (decrypt key rounds)
  (let
...

Lisp On CipherSaber

by Chris Jester-Young, June 22, 2008 11:16

Looking at the code, I just...

729442eea8d8548842a6e0947e333c7b Talk
1
2
3
4
(defun group-by (lst n)
  (cond ((null lst) nil)
	(t (cons (first-n n lst)
...

Lisp On Group-by

by jsmcgd, May 24, 2008 13:30

It isn't tail recursive and...

Avatar Talk

Lisp On matrix transpose

by confused?, May 23, 2008 21:58

that's great! how did you d...

E9558f012a4568bcce3555bbe5573e00 Talk
1
2
(defun transpose (m)
  (apply #'mapcar #'list m))

Lisp On matrix transpose

by anonymous, May 23, 2008 19:17
Avatar Talk
1
2
3
4
;; get the firt n element from a list
;; parameter:
;;     l -> list to split
...

Lisp On Group-by

by Eineki, December 22, 2007 01:38

What do you think of this r...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
(defun Transpose (m) (Cond ((CAR m) (Cons (MapCAR 'CAR m) (Transpose (MapCAR 'CDR m))))))

Lisp On matrix transpose

by acjr, November 08, 2007 12:01

If the "Cond" returns a val...

Ca569f6c87196fd0a204719c7885370f Talk

Lisp On Lexicographically next perm...

by Sunnan, October 15, 2007 11:51

p.s. your Bind macro is ava...

Fe9b3250264e25222a755215cc8a3dbf Talk
1
2
3
4
(require-extension miscmacros srfi-1)

(define (next-lex nums)
...

Lisp On Lexicographically next perm...

by Sunnan, October 15, 2007 11:32

Tried changing the algo to ...

Fe9b3250264e25222a755215cc8a3dbf Talk

Lisp On Lexicographically next perm...

by akkartik.livejournal.com/, October 09, 2007 01:43

Nice!

1. How is the 'on' l...

14d99459914c594998d2506db1e868c2 Talk
1
2
3
4
  (defun next-lex (a)
    (with var r = (reverse a)
          var pivor = (first-down r)
...

Lisp On Lexicographically next perm...

by niv, October 09, 2007 00:45 Star_fullStar_fullStar_fullStar_fullStar_full

rewritten with the "with" m...

Avatar Talk
1
2
3
4
 (defun partition-upto (pivot a)
      (loop for e in a
            for r on a
...

Lisp On Lexicographically next perm...

by niv, October 09, 2007 00:41 Star_fullStar_fullStar_full

sorry, it's actually for r ...

Avatar Talk
1
2
3
4
  (defun first-down (a)
    (loop for fst in a 
          for scd in (cdr a)
...

Lisp On Lexicographically next perm...

by niv, October 09, 2007 00:39 Star_fullStar_fullStar_full

if you like (loop), also no...

Avatar Talk
1
2
3
 (defun partition-upto (pivot a)
       (values (remove-if (lambda (x) (> x pivot)))
               (remove-if (lambda (x) (< x pivot))))) 

Lisp On Lexicographically next perm...

by niv, October 09, 2007 00:29 Star_fullStar_fullStar_fullStar_full

if you don't care about eff...

Avatar Talk
1
2
3
4
  (defun partition-upto (pivot a &optional less more)
      (cond
        ((eql (car a) pivot)
...

Lisp On Lexicographically next perm...

by niv, October 09, 2007 00:26 Star_fullStar_fullStar_full

for starters

Avatar Talk
1
2
3
4
(defun transpose (m)
  (unless (null (car m))
    (cons (mapcar #'car m) (transpose (mapcar #'cdr m)))))
...

Lisp On matrix transpose

by mdengler, October 06, 2007 04:31

Style, and also didn't you ...

F2c50bde11723bbb26ac7aa17ee9a0ad Talk

Lisp On matrix transpose

by Kartik Agaram, October 03, 2007 12:55

Nice! Totally beats what I ...

14d99459914c594998d2506db1e868c2 Talk

Lisp On folding of non-ascii long h...

by luser.myopenid.com/, October 03, 2007 09:01

YES! Although "~^~% " seems...

Avatar Talk
1
2
3
4
(defun header-encode (string)
  (if (find-if (lambda (c) (> (char-code c) 127)) string)
...

Lisp On folding of non-ascii long h...

by Aaron, October 02, 2007 12:10 Star_fullStar_fullStar_full

Is this what you want? I h...

Avatar Talk