Jun 15, 2019, 2:55 PM by a...@software-lab.de:
> (copy '@) is a no-op. 'copy' only copies the top level *cells* of a *list*.
> '@'
> is a symbol. But with 'cons' it is not needed anyway, as 'cons' makes a new
> cell.
>
Yes, of cource! The doc does say it returns atoms unchanged. It's virtually th
On Sat, Jun 15, 2019 at 11:06:52AM +0200, JmageK wrote:
> I guess the inefficiency of copying the whole lists can be mitigated partially
> by passing a copy of '@ to conc I tested & it works fine across function
> calls. But then may as well use cons solution.
>
> (cons (copy'@) (conc (chop "Si"
Jun 15, 2019, 1:57 PM by a...@software-lab.de:
> will concatenate the rest to the cell (@). This works well if called only a
> single time (e.g. in the REPL), but is not desirable if it is in a function
> definition.
>
Right! It hanged the REPL on a 2nd function call
> Instead, you could call th
On Sat, Jun 15, 2019 at 10:03:02AM +0200, JmageK wrote:
> >> : (conc (cons '@) (chop S) '(@))
> >> -> (@ "t" "s" "t" @)
> >
> I mean (conc '(@)(chop S)'(@))
Well, this is not to recommend.
'conc' is a destructive operation, so
(conc '(@) ...
will concatenate the rest to the cell (@). This wo
On Sat, Jun 15, 2019 at 10:01:08AM +0200, JmageK wrote:
> > The shortest and fastest way is probably:
> > : (conc (cons '@) (chop S) '(@))
> > -> (@ "t" "s" "t" @)
> >
> Basically (cons '(@)(chop S)'(@))
Well, not really. 'cons' gives a different result ;)
☺/ A!ex
--
UNSUBSCRIBE: mailto:picoli
Jun 15, 2019, 1:31 PM by jma...@tuta.io:
>> The shortest and fastest way is probably:
>> : (conc (cons '@) (chop S) '(@))
>> -> (@ "t" "s" "t" @)
>>
> Basically (cons '(@)(chop S)'(@))
> Neat solution. Thanks!
>
I mean (conc '(@)(chop S)'(@))
JmageK
--
Securely sent with Tutanota
--
UNSUBSCRIB
Jun 15, 2019, 11:19 AM by a...@software-lab.de:
> : (make (link '@) (mapc link (chop S)) (link '@))
> -> (@ "t" "s" "t" @)
>
> or better
> : (make (link '@) (chain (chop S)) (link '@))
> -> (@ "t" "s" "t" @)
>
> The shortest and fastest way is probably:
> : (conc (cons '@) (chop S) '(@))
> -
Hi JmageK,
> : (Let S "tst"
> (match (list '@ (mapcar any (chop S)) '@)
> (chop "1st tst nil") ) )
If you look at
: (list '@ (mapcar any (chop S)) '@)
-> (@ (t s t) @)
you see that you match against a tree-element-list (besides that the 'any' is
not helpful here).
What we need i
I know I can do this
: (match '(@ ~(chop "ts") @) (chop "tst"))
-> T
But i want to do the following, which doesn't work
: (Let S "tst"
(match (list '@ (mapcar any (chop S)) '@)
(chop "1st tst nil") ) )
-> NIL
JmageK
--
Securely sent with Tutanota
--
UNSUBSCRIBE: mailto:picolisp@software-