;;; ind-util.el --- Transliteration and Misc. Tools for Indian Languages -*- coding: iso-2022-7bit; -*-
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
;; Free Software Foundation, Inc.
;; Maintainer: KAWABATA, Taichi <kawabata@m17n.org>
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
(;; misc
nil ".m" ".h" "'" nil "." nil)))
-(defun mapthread (function seq1 &rest seqrest)
- "Apply FUNCTION to each element of SEQ1 and return result list.
-If there are several SEQRESTs, FUNCTION is called with that many
-arguments, with all possible combinations of these multiple SEQUENCES.
-Thus, if SEQ1 contains 3 elements and SEQ2 contains 5 elements, then
-FUNCTION will be called 15 times."
- (if seqrest
- (mapcar
- (lambda (x)
- (apply
- 'mapthread
- `(lambda (&rest y) (apply ',function x y))
- seqrest))
- seq1)
- (mapcar function seq1)))
+(defun combinatorial (head &rest tail)
+ (if tail
+ (apply 'append
+ (mapcar (lambda (y) (mapcar (lambda (x) (cons x y)) head))
+ (apply 'combinatorial tail)))
+ (mapcar 'list head)))
(defun indian--puthash-char (char trans-char hashtbls)
(let ((encode-hash (car hashtbls)) ;; char -> trans
(if (stringp trans-v) (setq trans-v (list trans-v)))
(indian--puthash-char
(concat c v)
- (apply 'append
- (mapthread 'concat trans-c trans-v))
+ (mapcar (lambda (x) (apply 'concat x))
+ (combinatorial trans-c trans-v))
hashtbls)))
v trans-v))
c trans-c))
(defun in-is13194-post-read-conversion (len)
(let ((pos (point)) endpos)
(setq endpos (iscii-to-ucs-region pos (+ pos len)))
- (indian-compose-region pos endpos)
(- endpos pos)))
;;;###autoload
(provide 'ind-util)
-;;; arch-tag: 59aacd71-46c2-4cb3-bb26-e12bbad55545
+;; arch-tag: 59aacd71-46c2-4cb3-bb26-e12bbad55545
;;; ind-util.el ends here