guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help : call function with args


From: calcium
Subject: Re: help : call function with args
Date: Wed, 4 Apr 2018 09:43:18 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

Sorry, I tried to use a disposable email web service, but it didn’t
work, so I just created a email account.


The question was how to do what I intended with this code (sorry I don’t
know how to express this with words) :


(define (f a b c d)

(+ a b c d))


(f 1 (values 2 3) 4)


;;so that I can return multiples args inside a cond or an if statement
calling a function like:


(f 1

(if #t (values 2 3)

(values 4 5))

6)


;;and if this is not possible, which way would be the best to write this
sort of things ?, would it be using internal define so that I only have
to write the different values of the arguments inside the new shortened
function?.



And while I am asking, is there a way to use the default value of an
optional key, but using the key :


(define* (rice #:key (color 'white) (weight 10))

(list color weight))

(define* (lst-of-rice #:key (color 'white) (weight 10))

(list (rice #:color color #:weight weight)

(rice #:color color #:weight weight)))


;;sot that instead of writing in lst-of-rice (color ‘white), write
(color UseSameAsKeyofRice), or something that use the default value of
rice, if no value is given in lst-of-rice, and use the value of
lst-of-rice when we use is key.


Thanks, and sorry for the first email.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]