Hi David,
Am Di., 23. Apr. 2019 um 04:12 Uhr schrieb David Pirotte :
> ...
> > Now `core-guile-condition´ feels like a case for `match´, but I
> > couldn't make it work.
> > Is this a bad use case and alist searching is always preferable?
>
> I would do this:
[...]
regarding your code, it's all o
Hello THomas,
> ...
> Now `core-guile-condition´ feels like a case for `match´, but I
> couldn't make it work.
> Is this a bad use case and alist searching is always preferable?
I would do this:
(define (is-spanner? grob)
(match grob
((g-key . g-vals)
(let ((meta (assq-ref g-vals 'met
Am So., 21. Apr. 2019 um 23:51 Uhr schrieb David Pirotte :
> > Whether 'pattern matching' will be useful to hide complexity to make
> > life easier for our users or whether it adds an abstraction layer,
> > which would make it even harder for users to write their own
> > guile-code, I can't judge
Hi Thomas,
> ...
> Thanks again!
You're welcome.
I used 'funny' (weird) procedure and variable names, but if the procedure is to
be
exposed to your users, and with the objective of making it simple to use, read
and
maintain, as you described later in your answer, you could write it as - using
Am So., 21. Apr. 2019 um 02:34 Uhr schrieb David Pirotte :
>
> Hi Thomas,
>
> > ...
> > Thanks pointing me to this possibility, in my use-case I then could do:
> > (define (p) (cons '(1 2 3) '(4 5 6)))
> > (define l1 '(a b c))
> > (define l2 '(x y z))
> > (cons* l1 l2 (car (p)) (cdr (p)) '())
> > =
Hi Thomas,
> ...
> Thanks pointing me to this possibility, in my use-case I then could do:
> (define (p) (cons '(1 2 3) '(4 5 6)))
> (define l1 '(a b c))
> (define l2 '(x y z))
> (cons* l1 l2 (car (p)) (cdr (p)) '())
> =>
> ((a b c) (x y z) (1 2 3) (4 5 6))
Yes, if you can (you mentioned the co
Hi David,
Am Sa., 20. Apr. 2019 um 03:52 Uhr schrieb David Pirotte :
>
> Hi again,
>
> Replying twice to myself in a row, how is that :)
> A little tired I guess ...
>
> > > Note that the above will only work if the last 'blue item' has 3
> > > elements, you'd
> > > need to adapt
Hi again,
Replying twice to myself in a row, how is that :)
A little tired I guess ...
> > Note that the above will only work if the last 'blue item' has 3 elements,
> > you'd
> > need to adapt for other use case (which also 'speak' in favor of the cleaner
> > approach.
> Actu
Hi again,
> Note that the above will only work if the last 'blue item' has 3 elements,
> you'd
> need to adapt for other use case (which also 'speak' in favor of the cleaner
> approach.
Actually, I didn't like what I wrote, here is a slightly better code:
(use-modules (ice-9 match))
(define (b
Hi Thomas,
> Failing example:
> (map
> car
> (cons '(a b c) (cons '(1 2 3) '(x y z
> One way to make it work is to convert the initial pair (cons '(1 2 3)
> '(x y z)) to a list of lists, i.e (cons '(1 2 3) (list '(x y z)))
> The question is: is it the only and/or best way?
It sounds a lo
Am Fr., 19. Apr. 2019 um 17:09 Uhr schrieb Malte Meyn :
>
>
>
> Am 19.04.19 um 16:35 schrieb Thomas Morley:
> > I could do
> > (cons '(a b c) (list (car (list-pair)) (cdr (list-pair
> > and to get the last list: (last ...)
> > Looksy clumsy, though.
> >
> > Any better method?
>
> I’m not sure w
Am 19.04.19 um 16:35 schrieb Thomas Morley:
I could do
(cons '(a b c) (list (car (list-pair)) (cdr (list-pair
and to get the last list: (last ...)
Looksy clumsy, though.
Any better method?
I’m not sure what you want to do here. But maybe it would be easier to
convert the pair of lists t
Hi all,
let's say I've a procedure building a pair of lists. Actually it's a
built-in procedure, so I can't change it.
For the sake of simplicity let's take:
(define (list-pair) (cons '(1 2 3) '(x y z)))
(list-pair) returns ((1 2 3) x y z)
(cdr (list-pair)) returns the second list, i.e. (x y z)
Al
13 matches
Mail list logo