unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* low-hanging SRFI fruit (SRFI-98)
@ 2009-05-27  2:43 Julian Graham
  2009-05-27 21:27 ` Neil Jerram
  0 siblings, 1 reply; 12+ messages in thread
From: Julian Graham @ 2009-05-27  2:43 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

Hi Guilers,

While looking over the prerequisites for the proposed SRFI-100, I came
across SRFI-98, which seemed like pretty easy win for Guile.  So I did
a quick implementation on the subway -- find it attached.  I'll write
up unit tests and docs if people think it's suitable for integration.


Regards,
Julian

[-- Attachment #2: srfi-98.scm --]
[-- Type: text/x-scheme, Size: 1614 bytes --]

;;; srfi-98.scm --- An interface to access environment variables

;; Copyright (C) 2009 Free Software Foundation, Inc.
;;
;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public
;; License as published by the Free Software Foundation; either
;; version 2.1 of the License, or (at your option) any later version.
;; 
;; This library is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; Lesser General Public License for more details.
;; 
;; You should have received a copy of the GNU Lesser General Public
;; License along with this library; if not, write to the Free Software
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

;;; Author: Julian Graham <julian.graham@aya.yale.edu>
;;; Date: 2009-05-26

;;; Commentary:

;; This is an implementation of SRFI-98 (An interface to access environment 
;; variables).
;;
;; This module is fully documented in the Guile Reference Manual.

;;; Code:

(define-module (srfi srfi-98)
  :use-module (srfi srfi-1)
  :export (get-environment-variable
	   get-environment-variables))

(cond-expand-provide (current-module) '(srfi-98))

(define get-environment-variable getenv)
(define (get-environment-variables)
  (define (string->alist-entry str)
    (let ((pvt (string-index str #\=))
	  (len (string-length str)))
      (and pvt (cons (substring str 0 pvt) (substring str (+ pvt 1) len)))))
  (filter-map string->alist-entry (environ)))

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-06-05 21:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-27  2:43 low-hanging SRFI fruit (SRFI-98) Julian Graham
2009-05-27 21:27 ` Neil Jerram
2009-05-28 22:19   ` Julian Graham
2009-05-30 22:11     ` Neil Jerram
2009-05-30 23:13       ` Julian Graham
2009-05-30 23:47         ` Neil Jerram
     [not found]           ` <2bc5f8210906020659n1cdb9c05k4b10f3903d99e9c2@mail.gmail.com>
     [not found]             ` <87y6sa1e82.fsf@arudy.ossau.uklinux.net>
     [not found]               ` <2bc5f8210906021956q6608134cucfa8f79b1d5964d8@mail.gmail.com>
     [not found]                 ` <878wk96aah.fsf@gnu.org>
     [not found]                   ` <2bc5f8210906030618j552a03ddm603744a1be0ca571@mail.gmail.com>
     [not found]                     ` <87fxehsb7s.fsf@gnu.org>
     [not found]                       ` <2bc5f8210906030647t6cd8bb68q79e9bffc1ab765b2@mail.gmail.com>
     [not found]                         ` <87skihw4k5.fsf@arudy.ossau.uklinux.net>
2009-06-03 22:08                           ` Neil Jerram
2009-06-03 22:58                             ` Neil Jerram
2009-06-04 19:20                             ` Andy Wingo
2009-06-04 21:10                               ` Neil Jerram
2009-06-05 21:23                                 ` Neil Jerram
2009-05-30 23:28     ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).