You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
?- between(99,102,N),length(L,N), append(L,_,[a|L]).
N = 99, L = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
; N = 100, L = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
; N = 101, L = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
unexpected.
; N = 102, L = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
unexpected.
(Wasn't there the ||... abbreviation?)
The text was updated successfully, but these errors were encountered:
I've been coming to the view that what you ask for is what you get. 100 is the default for truncating things at the top level. To that end lists should probably not show |... as the truncation indicator as well. Thanks for reminding me. I realize this a complete 180 for me.
?- length(L,N), append(L,_,[1|L]),N > 99.
L = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], N = 100
; L = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1|...], N = 101
; ... .
are fine. You use here the atom ... with a special meaning as it is produced by many top level loops.
But for strings, your answer starting with 101 is just wrong. By showing ||... at the end, as (I believe) you did previously, you indicate that something is missing. And this could also be a valid syntax extension such that "abc"||L means [a,b,c|L].
(Wasn't there the
||...
abbreviation?)The text was updated successfully, but these errors were encountered: