Changeset 38246 in project


Ignore:
Timestamp:
03/14/20 18:22:42 (3 weeks ago)
Author:
Kon Lovett
Message:

exporting string-longest-common-prefix already

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/string-utils

    r37681 r38246  
    212212==== string-fixed-length
    213213
    214 <procedure>(string-fixed-length S N [pad-char: #\space] [trailing: "..."]) -> string</procedure>
     214<procedure>(string-fixed-length S N [pad-char: #\space] [trailing: "..."]) --> string</procedure>
    215215
    216216Returns the string {{S}} with the {{string-length}} fixed to {{N}}.
     
    219219{{trailing}}.
    220220
     221==== string-longest-common-prefix
     222
     223<procedure>(string-longest-common-prefix CANDIDATE OTHERS) --> (or boolean string)</procedure>
     224
     225Returns the member with the longest comment prefix of {{CANDIDATE}} from
     226{{OTHERS}}, or {{#f}}.
     227
     228; CANDIDATE : {{string}}
     229; OTHERS : {{(list-of string)}}
     230
    221231=== String Interpolation
    222232
    223 ==== Usage
    224 
    225 <enscript language=scheme>
    226 (import string-interpolation-syntax)
    227 </enscript>
    228 
    229 ==== set-sharp-string-interpolation-syntax
    230 
    231 <procedure>(set-sharp-string-interpolation-syntax PROC)</procedure>
    232 
    233 Extends the read-syntax with #"..." where the {{"..."}} is evaluated using
    234 {{(PROC "...")}}. When {{PROC}} is {{#f}} the read-syntax is cleared. When
    235 {{PROC}} is {{#t}} then {{PROC}} is {{identity}}.
    236 
    237 <enscript language=scheme>
    238 (use string-interpolation-syntax utf8-string-interpolation)
    239 
    240 (set-sharp-string-interpolation-syntax string-interpolate)
    241 #"foo #(+ 1 2)bar #{(and 1 2)} baz"
    242 ;=> "foo 3bar 2 baz"
    243 </enscript>
     233Extends the read-syntax with #"..." where tagged scheme expressions in the
     234string are evaluated at runtime.
     235
     236Similar to the {{#<#}} multi-line string.
    244237
    245238See [[http://wiki.call-cc.org/man/5/Extensions%20to%20the%20standard#multiline-string-constant-with-embedded-expressions|Multiline String Constant with Embedded Expressions]].
    246239
     240<enscript language=scheme>
     241(import utf8-string-interpolation)
     242
     243#"@ #(+ 1 2)## (#'and #1 #2) = #(and 1 2) trailing #"
     244;=> "@ 3# (and 1 2) = 2 trailing #"
     245</enscript>
     246
     247'''Note''' Support for the #{<sexpr>} subform is deprecated; use the #<sexpr> form.
     248
    247249==== Usage
    248250
     
    251253</enscript>
    252254
    253 ==== string-interpolate
    254 
    255 <procedure>(string-interpolate STR [eval-tag: EVAL-TAG]) -> list</procedure>
    256 
    257 Performs substitution of embedded Scheme expressions, prefixed with
    258 {{EVAL-TAG}} and optionally enclosed in curly brackets. Two consecutive
    259 {{EVAL-TAG}}s are translated to a single {{EVAL-TAG}}.
    260 
    261 Similar to the {{#<#}} multi-line string.
    262 
    263 {{STR}} is a {{string}}.
    264 
    265 {{EVAL-TAG}} is a {{character}}, default {{#\#}}.
     255<enscript>
     256csc -extend string-interpolation ...
     257</enscript>
     258
     259<enscript>
     260csi -require-extension string-interpolation ...
     261</enscript>
     262
     263Activates string-interpolation.
    266264
    267265Automatically invokes {{(set-sharp-string-interpolation-syntax
    268266string-interpolate)}} on load.
     267
     268==== Usage
     269
     270<enscript language=scheme>
     271(import string-interpolation-syntax)
     272</enscript>
     273
     274==== set-sharp-string-interpolation-syntax
     275
     276<procedure>(set-sharp-string-interpolation-syntax PROC)</procedure>
     277
     278Extends the read-syntax with #"..." where the {{"..."}} is evaluated using
     279{{(PROC "...")}}.
     280
     281; {{PROC}} : {{#f}} ; read-syntax is cleared.
     282; {{PROC}} : {{#t}} ; {{PROC}} is {{identity}}.
     283; {{PROC}} : {{procedure}} ; interpolation function.
     284
     285==== Usage
     286
     287<enscript language=scheme>
     288(import string-interpolator) ;or (import utf8-string-interpolator)
     289</enscript>
     290
     291==== string-interpolate
     292
     293<procedure>(string-interpolate STR [eval-tag: EVAL-TAG]) -> list</procedure>
     294
     295Performs substitution of embedded Scheme expressions, prefixed with
     296{{EVAL-TAG}}. Two consecutive {{EVAL-TAG}}s are translated to a single
     297{{EVAL-TAG}}. A trailing {{EVAL-TAG}} is taken literally.
     298
     299; {{STR}} : {{string}}.
     300; {{EVAL-TAG}} : {{character}}, default {{#\#}}.
    269301
    270302
     
    312344== License
    313345
    314 Copyright (C) 2010-2017 Kon Lovett.  All rights reserved.
     346Copyright (C) 2010-2020 Kon Lovett.  All rights reserved.
    315347
    316348Permission is hereby granted, free of charge, to any person obtaining a
Note: See TracChangeset for help on using the changeset viewer.