Commit 7f485182 authored by Liam Healy's avatar Liam Healy

Replace mapcan with mappend

In cases where the lists being nconced exist external to the call,
replace mapcan with user-defined mappend to prevent destructive
parent c0c80c3d
;; Definitions for macro expansion
;; Liam Healy 2009-03-15 14:50:28EDT callback-compile-defs.lisp
;; Time-stamp: <2009-03-18 22:46:59EDT callback-compile-defs.lisp>
;; Time-stamp: <2009-04-01 21:36:12EDT callback-compile-defs.lisp>
;; $Id: $
(in-package :gsl)
......@@ -25,8 +25,8 @@
',(parse-callback-static cbs 'callback-structure-type)
(when (dimension-names object)
(mapcan 'list (dimension-names object) (dimensions object)))
(mappend 'list (dimension-names object) (dimensions object)))
(lambda (fn) `',(parse-callback-fnspec fn 'structure-slot-name))
;; Helpers that define a single GSL function interface
;; Liam Healy 2009-01-07 22:02:20EST defmfun-single.lisp
;; Time-stamp: <2009-03-31 21:37:38EDT defmfun-single.lisp>
;; Time-stamp: <2009-04-01 21:36:13EDT defmfun-single.lisp>
;; $Id: $
(in-package :gsl)
......@@ -32,14 +32,14 @@
(find-package :keyword))))
(list sexp))
(unless (member (first sexp) '(quote))
(mapcan #'scwfv (rest sexp))))))
(mappend #'scwfv (rest sexp))))))
(remove nil (remove-duplicates (scwfv sexp)))))
(defun variables-used-in-c-arguments (c-arguments)
"Find the arguments passed to the C function. This is a poor
quality code walker, but is sufficient for actual usage of defmfun."
(mapcan (lambda (carg)
(mappend (lambda (carg)
(stupid-code-walk-find-variables (st-symbol carg)))
:from-end t))
......@@ -171,7 +171,7 @@
(first (cl-convert-form it))
(callback-remove-arg allocated-decl callbacks 'st-symbol))
......@@ -194,7 +194,7 @@
(let ((,cret-name
(lambda (arg)
(let ((cfind ; variable is complex
(find (st-symbol arg) complex-args :key 'first)))
......@@ -233,7 +233,7 @@
"Generate the return computation expression for defmfun."
(case c-return
(lambda (vbl seq)
`((when (> ,cret-name ,seq) ,vbl)))
;; Lisp forms
;; Liam Healy 2009-03-07 15:49:25EST forms.lisp
;; Time-stamp: <2009-03-14 18:44:04EDT forms.lisp>
;; Time-stamp: <2009-04-01 21:33:58EDT forms.lisp>
(in-package :gsl)
......@@ -39,3 +39,12 @@
(let ((pos (position symbol plain)))
(when pos
(nth pos cats)))))
;;;; Utility
(defun mappend (fn &rest lsts)
"maps elements in list and finally appends all resulted lists."
(apply #'append (apply #'mapcar fn lsts)))
;; Definition of GSL objects and ways to use them.
;; Liam Healy, Sun Dec 3 2006 - 10:21
;; Time-stamp: <2009-03-29 23:04:45EDT mobject.lisp>
;; Time-stamp: <2009-04-01 21:36:13EDT mobject.lisp>
;;; GSL objects are represented in GSLL as and instance of a 'mobject.
;;; The macro demobject takes care of defining the appropriate
......@@ -266,7 +266,7 @@
(defun symbol-keyword-symbol (symbol &optional singular)
"Make a list of key symbol, listifying if singular."
(if (listp symbol)
(mapcan (lambda (s) (symbol-keyword-symbol s singular)) symbol)
(mappend (lambda (s) (symbol-keyword-symbol s singular)) symbol)
(if (member (singular-symbol symbol) singular)
(list (intern (symbol-name symbol) :keyword)
`(list ,(singular-symbol symbol)))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment